function Colbar2 = kuvaPlottaus(Im,STR,STR2)

%function kuvaPlottaus(band2,band1,Im1,filename)


%band1=1;
%band2=5;

MAT1=[];
MAT2=[];
MAT3=[];

iter = 1;
for k = 13:2:78
    if iter <= 11
        MAT1 = [MAT1 rot90(Im.img(:,:,k))];
    elseif iter <= 22
        MAT2 = [MAT2 rot90(Im.img(:,:,k))];
    else
        MAT3 = [MAT3 rot90(Im.img(:,:,k))];
    end
    iter = iter + 1;
end

Anat = rot90(squeeze(Im.anatomy(46,:,:)));
Anat(1:10,:) = [];
Anat(:,1:8) = [];
Anat(:,end-7:end) = [];

MAT = [MAT1;MAT2;MAT3];
MAT = [MAT;65*ones(size(Anat,1),size(MAT,2))];

MAT(end-size(Anat,1)+1-10:end-10,end-size(Anat,2)+1-100:end-100) = Anat;
MAT1=MAT(:,1:359);
MAT2=MAT(:,360:end);

figure;
set(gcf,'ColorMap',Im.colMap,'Units','pixels','Position',[10 10 size(MAT,2),size(MAT,1)]);

F1=subplot(211);
F2=subplot(212);
axes(F1);axis off;

set(gca,'Units','pixels','Position',[1 1 359 size(MAT,1)])%,[0 0 0.3636 1]);axis off;
image(MAT1);
axes(F2);
set(gca,'Units','pixels','Position',[360 1 size(MAT,2)-359 size(MAT,1)])%,[0 0 0.3636 1]);axis off;
image(MAT2);axis off;

axes(F1);
set(gca,'Units','Normalized')
axes(F2);
set(gca,'Units','Normalized')

axes(F1);Colbar1=colorbar;
set(Colbar1,'Location','South','XTick',get(Im.colBar1,'XTick'),'Fontsize',9,'XTickLabel',get(Im.colBar1,'XTickLabel') );
axes(F2);Colbar2=colorbar;
XT = get(Im.colBar1,'XTick');
XTL = get(Im.colBar1,'XTickLabel');

set(Colbar2,'Location','South','XLim',get(Im.colBar2,'XLim'),...
    'XTick',XT,'XTickLabel', XTL);

if strcmp(STR,'bands')
    set(Colbar2,'Position',[0.03 0.07 0.6 0.06],'Xlim',[1.5 5.5],'FontName','arial','box','on','XColor','w','YColor','w')
    STR = STR2;
    annotation13 = annotation(...
    gcf,'textbox',...
    'Position',[0.675 0.085 0.28 0.06],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FitHeightToText','off',...
    'FontName','arial',...
    'FontSize',9,...
    'String',{Im.session});

    
    delete(Colbar1)
elseif strcmp(STR,'comp')
    if length(XT)>18
    XT = XT(1:2:end);
    iter = 1;
    for k = 1:2:size(XTL,1)
        XXTL(iter,:) = XTL(k,:);
        iter = iter + 1;
    end
    XTL = XXTL;
    end
    set(Colbar1,'XTick',XT,'XTickLabel', XTL);
    set(Colbar2,'XTick',XT,'XTickLabel', XTL);

    set(Colbar1,'Position',[0.06 0.07 0.28 0.06],'Fontsize',9,'Xlim',[0.5+Im.th 63.5],'FontName','arial','box','on','XColor','w','YColor','w')
    STR = STR2;
    set(Colbar2,'Position',[0.38 0.07 0.28 0.06],'Fontsize',9,'Xlim',[128.5+Im.th 191.5],'FontName','arial','box','on','XColor','w','YColor','w')

    annotation11 = annotation(...
    gcf,'textbox',...
    'Position',[0.07 0.02 0.28 0.06],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FitHeightToText','off',...
    'FontName','arial',...
    'FontSize',9,...
    'String',{Im.band{3}});

    annotation12 = annotation(...
    gcf,'textbox',...
    'Position',[0.39 0.02 0.28 0.06],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FitHeightToText','off',...
    'FontName','arial',...
    'FontSize',9,...
    'String',{Im.band{4}});

    annotation13 = annotation(...
    gcf,'textbox',...
    'Position',[0.675 0.085 0.28 0.06],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FitHeightToText','off',...
    'FontName','arial',...
    'FontSize',9,...
    'String',{Im.session});



else
    set(Colbar2,'Position',[0.06 0.07 0.28 0.06],'Fontsize',9,'Xlim',[0.5+Im.th 63.5],'FontName','arial','box','on','XColor','w','YColor','w')
    annotation12 = annotation(...
    gcf,'textbox',...
    'Position',[0.14 0.02 0.28 0.06],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FitHeightToText','off',...
    'FontName','arial',...
    'FontSize',9,...
    'String',{Im.band});

    annotation13 = annotation(...
    gcf,'textbox',...
    'Position',[0.675 0.085 0.28 0.06],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FitHeightToText','off',...
    'FontName','arial',...
    'FontSize',9,...
    'String',{Im.session});



    delete(Colbar1)
end

%% Create textbox
annotation2 = annotation(...
    gcf,'textbox',...
    'Position',[0.9 0.004 0.07538 0.09691],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FontName','arial',...
    'FontSize',9,...
    'String',{'z = -66'},...
    'FitHeightToText','on');

%% Create textbox
annotation3 = annotation(...
    gcf,'textbox',...
    'Position',[0.9 0.057 0.07538 0.09691],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FontName','arial',...
    'FontSize',9,...
    'String',{'z = -22'},...
    'FitHeightToText','on');

% Create textbox
annotation6 = annotation(...
    gcf,'textbox',...
    'Position',[0.90 0.11 0.07978 0.09691],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FontName','arial',...
    'FontSize',9,...
    'String',{'z = +22'},...
    'FitHeightToText','on');

C = 0.143;
%% Create annotation
annotation3 = annotation(...
  gcf,'line',...
  [0.805 0.9],[0.1648 0.1648],...
  'LineWidth',1,...
  'Color',[0 1 0]);
 
%% Create annotation
annotation4 = annotation(...
  gcf,'line',...
  [0.805 0.9],[0.1099 0.1099],...
  'LineWidth',1,...
  'Color',[0 1 0]);
   
%% Create annotation
annotation5 = annotation(...
  gcf,'line',...
  [0.805 0.9],[0.057 0.057],...
  'LineWidth',1,...
  'Color',[0 1 0]);


%% Create textbox
annotation7 = annotation(...
    gcf,'textbox',...
    'Position',[0.003 0.397 0.07978 0.09691],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FontName','arial',...
    'FontSize',9,...
    'String',{'z = +22'},...
    'FitHeightToText','on');

%% Create textbox
annotation8 = annotation(...
    gcf,'textbox',...
    'Position',[0.003 0.687 0.07978 0.09691],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FontName','arial',...
    'FontSize',9,...
    'String',{'z = -22'},...
    'FitHeightToText','on');

%% Create textbox
annotation9 = annotation(...
    gcf,'textbox',...
    'Position',[0.003 0.92 0.07978 0.09691],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FontName','arial',...
    'FontSize',9,...
    'String',{'z = -66'},...
    'FitHeightToText','on');


annotation10 = annotation(...
    gcf,'textbox',...
    'Position',[0 0.03 0.06 0.04705],...
    'LineStyle','none',...
    'Color',[1 1 1],...
    'FitHeightToText','off',...
    'FontName','arial',...
    'FontSize',10,...
    'String',{STR});





%set(Colbar2,'XColor',[1 1 1],'YColor',[1 1 1]);

set(gcf,'Units','centimeters','Position',[5   5   16   7])
%set(gcf,'Position',[566 439 602 311])



%axes(F2);set(Colbar2,'Xlim',[1.5 5.5])




%annotation4 = annotation(gcf,'textbox','Position',[0.4284 0.06429 0.045 0.07]...
%     ,'FitHeightToText','off','String',{['ZPF_{\Sigma}^{s^' num2str(band1) 's^' num2str(band2) '}']},'LineStyle','none');
%annotation5 = annotation(gcf,'textbox','Position',[0.02742 0.07072 0.045 0.07]...
%     ,'FitHeightToText','off','String',{['ZPF_{\Sigma}^{s^' num2str(band2) 's^' num2str(band1) '}']},'LineStyle','none');


